package com.cmy.web.fragment

import android.content.Context
import android.os.Bundle
import android.view.View
import com.cmy.framework_base.basics.BasicsLazyFragment
import com.cmy.web.activity.X5WebActivity
import com.cmy.web.databinding.FragmentWebX5Binding

/**
 * @name:
 *  X5WebFragment
 * @package:
 *  com.cmy.web.fragment
 * @date:
 *  2023/4/2616:20
 * @author
 *    cmy
 * @description
 *
 */
class X5WebFragment : BasicsLazyFragment() {

    private val binding by lazy {FragmentWebX5Binding.inflate(layoutInflater)}


    private var url : String? = null

    protected  val mWebView = binding.webView

    override fun getContentView(): View = binding.root

    companion object{
        private const val KEY_URL = "Web_view_x5_url_key"

        fun newInstance(url: String? = null):X5WebFragment{
           val fragment = X5WebFragment()
            url?.let {
                val bundle = Bundle()
                bundle.putString(KEY_URL,it)
            }
            return fragment
        }
    }


    override fun doBundle(bundle: Bundle) {
        url = bundle.getString(KEY_URL)
    }


    override fun lazyLoad() {

    }


    override fun initView(bundle: Bundle?) {
        url?.let {
            mWebView.loadUrl(it)
        }
    }
}